package com.bee.caf_ss_android.common;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;

import com.bee.caf_ss_android.R;


public class LoadingDialog extends AlertDialog {


    public LoadingDialog(Context context, int theme) {
        super(context, theme);
        this.setCancelable(false);
        BackgroundDarkening();
    }


    /**
     * 弹出dialog时，页面变暗
     */
    public void BackgroundDarkening(){
        WindowManager.LayoutParams l = getWindow().getAttributes();
        //0.0f完全不暗，即背景是可见的 ，1.0f时候，背景全部变黑暗。
        l.dimAmount = 0.2f;
        //设置背景全部变暗的效果
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        getWindow().setAttributes(l);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.view_tips_loading);
        this.setCanceledOnTouchOutside(false);
    }


}
